home *** CD-ROM | disk | FTP | other *** search
/ Aminet 32 / Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso / Aminet / dev / lang / Python151_Src.lha / Python1.5_Source / Amiga / sleep.c < prev    next >
C/C++ Source or Header  |  1998-12-25  |  1KB  |  61 lines

  1. RCS_ID_C="$Id: sleep.c,v 4.1 1994/09/29 23:09:02 jraja Exp $"
  2. /*
  3.  *      sleep.c - suspend process for the specified time
  4.  *
  5.  *      Copyright © 1994 AmiTCP/IP Group, 
  6.  *                       Network Solutions Development Inc.
  7.  *                       All rights reserved.
  8.  */
  9.  
  10. #include <sys/param.h>
  11. #ifdef AMITCP
  12. #include <unistd.h>
  13. #endif
  14. #ifdef INET225
  15. #include <proto/socket.h>
  16. #endif
  17. #include <sys/time.h>
  18. #include <sys/socket.h>
  19.  
  20. /****** net.lib/sleep *********************************************
  21.  
  22.     NAME
  23.     sleep - suspend process execution for the specified time
  24.  
  25.     SYNOPSIS
  26.     void sleep(unsigned int seconds);
  27.  
  28.     FUNCTION
  29.         Process execution is suspended for number of seconds specified in 
  30.         'seconds'. The sleep will be aborted if any of the break signals
  31.         specified for the process is received (only CTRL-C by default).
  32.  
  33.     PORTABILITY
  34.     UNIX
  35.  
  36.     INPUTS
  37.     'seconds' - number of seconds to sleep.
  38.  
  39.     RESULT
  40.         Does not return a value.
  41.  
  42.     NOTES
  43.         The sleep is implemented as a single select() call with all other
  44.         than time out argument as NULL.
  45.  
  46.     SEE ALSO
  47.     bsdsocket.library/select()
  48.  
  49. *****************************************************************************
  50. *
  51. */
  52.  
  53. void sleep(unsigned int secs)
  54. {
  55.   struct timeval tv;
  56.  
  57.   tv.tv_sec = secs;
  58.   tv.tv_usec = 0;
  59.   select(0, 0, 0, 0, &tv);
  60. }
  61.